package com.dhz.common.base.domain;

import java.io.Serializable;

/**
 * 分页查询条件继承该类
 */
public class PageQuery implements Serializable {
    private int pageNum = 1;
    private int pageSize = 10;
    private int startIndex;
    private int navPageSize = 6;
    private boolean all = false;

    public int getPageNum() {
        return pageNum;
    }

    public void setPageNum(int pageNum) {
        this.pageNum = pageNum<1?1:pageNum;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
        // this.all = pageSize < 1;
        // this.startIndex = this.pageNum<1?0:((this.pageNum-1)*this.pageSize);
    }

    public int getNavPageSize() {
        return navPageSize;
    }

    public void setNavPageSize(int navPageSize) {
        this.navPageSize = navPageSize;
    }

    public boolean isAll() {
        this.all = pageSize < 1;
        return all;
    }

    public void setAll(boolean all) {
        this.all = all;
    }

    public int getStartIndex() {
        this.startIndex = this.pageNum<1?0:((this.pageNum-1)*this.pageSize);
        return startIndex;
    }

    public void setStartIndex(int startIndex) {
        ;
    }

    @Override
    public String toString() {
        return "PageQuery{" +
                "pageNum=" + pageNum +
                ", pageSize=" + pageSize +
                ", startIndex=" + startIndex +
                ", navPageSize=" + navPageSize +
                ", all=" + all +
                '}';
    }
}
